import { configureStore } from '@reduxjs/toolkit';
import counterReducer from './module/contral';
import messageReducer from './module/message';
import {
    persistStore,
    persistReducer,
    FLUSH,
    REHYDRATE,
    PAUSE,
    PERSIST,
    PURGE,
    REGISTER,
} from 'redux-persist'
import storage from 'redux-persist/lib/storage'

const persistConfig = {
    key: 'root',
    version: 1,
    storage,
}
const store = configureStore({
    //stort.counter
    reducer: { 
        counter: persistReducer(persistConfig, counterReducer),
        message: messageReducer,
    },
    middleware: (getDefaultMiddleware) =>
        getDefaultMiddleware({
            serializableCheck: {
                ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
            },
        }),
})
persistStore(store)
export default store